import request from '@/utils/request'

// 库存报表
export function pageInventoryBalance(params: { pageNum?: number; pageSize?: number; warehouseId?: string; materialId?: string }) {
  return request({ url: '/erp/report/inventory/balance/page', method: 'get', params })
}

export function pageInventoryLedger(params: { 
  pageNum?: number
  pageSize?: number
  warehouseId?: string
  materialId?: string
  billType?: string
  ioType?: string
  startTime?: string
  endTime?: string
}) {
  return request({ url: '/erp/report/inventory/ledger/page', method: 'get', params })
}

export function getInventorySummary(params?: { warehouseId?: string; materialId?: string }) {
  return request({ url: '/erp/report/inventory/balance/summary', method: 'get', params })
}

// 财务报表
export function pageFinanceVoucher(params: {
  pageNum?: number
  pageSize?: number
  voucherNo?: string
  startDate?: string
  endDate?: string
  billType?: string
  billId?: string
}) {
  return request({ url: '/erp/report/finance/voucher/page', method: 'get', params })
}

export function getVoucherEntries(voucherId: string) {
  return request({ url: `/erp/report/finance/voucher/${voucherId}/entries`, method: 'get' })
}

export function getAccountBalance(params?: { accountId?: string; startDate?: string; endDate?: string }) {
  return request({ url: '/erp/report/finance/account/balance', method: 'get', params })
}

